<form action="${CONTEXT_PATH}/m/user/update" method="post" id="users_update" class="form-horizontal">
    <#include "/WEB-INF/template/page/admin/system/user/_form.ftl"/>
    <input type="hidden" name="m.uuid" value="${m.uuid}"/>
</form>
<script type="text/javascript">
    jQuery("#users_update").ready(function () {
        $("#userimg").fileupload({
            url: "${CONTEXT_PATH}/updown/up",//文件上传地址，当然也可以直接写在input的data-url属性内
            formData: {upflag: "sysuser_img", downflag: "down"},//此处为上传分类标志
            done: function (e, data) {
                $("[name='m.bigicon']").val(data.result.url);
                alert("图片上传成功");
            }
        });

        var bigicon = $(this).find("[name='m.bigicon']").val();
        if (bigicon && bigicon.length > 0) {
            $("#previewimg").attr("src", "${CONTEXT_PATH}" + bigicon);
        }

        phoneChina();  //添加手机号码验证phoneChina
        // 定义验证参数
        var validateOptions = $.extend(CONST_VALIDATE.OPTION, {
            rules: {
                "m.name": {
                    required: true,
                    maxlength: 45
                },
                "m.tel": {
                    required: true,
                    phoneChina: true
                },
                "m.email": {
                    required: true,
                    email:true
                }
            },
            messages: {
                "m.name": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入系统用户名称",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>系统用户名称不能大于{0}个字符")
                },
                "m.tel": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入手机号码",
                    phoneChina: "<i class='fa fa-exclamation tooltips'></i>请输入正确的手机号码",
                },
                "m.email": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入邮箱地址",
                    email: "<i class='fa fa-exclamation tooltips'></i>请输入正确的邮箱地址",
                }
            },
            submitHandler:function(form) {
                var modal = $("#ajax_update");
                $(form).ajaxSubmit(function (data, status, xhr) {
                    if (data.status) {
                        toastr.success(data.msg, '操作提示');
                    } else {
                        toastr.error(data.msg, '操作提示');
                    }
                });
                $(modal).modal('hide');
                dtgrid.load();
            }
        });
        //表单验证
        var validator = $("#users_update").validate(validateOptions);
    });
</script>